<?php

// ##############################################################################||
// #                                                                 
// #   MySmartBB Version 1.7.0	                                      
// #   http://www.MySmartBB.com                                      
// #   Copyright (c) 2008 by MySmartBB team                           
// #   license http://opensource.org/licenses/gpl-license.php GNU Public License
// #                                                             
// #   filename : rss.php                                         
// #   to show today subjects by rss             
// #                                                                  
// ##############################################################################||

// ** General definitions **

     define('NOT_IN_INDEX',1);

 session_start();
     include('includes/config.php');
     include('includes/SmartSQL.php');
     include('includes/function.php');
     include('includes/param.class.php');
   


     $DB = new SmartSQL;
     $DB->setinfo($db_server,$db_username,$db_password,$db_name);
     $DB->sql_connect();
     $DB->sql_selectdb();
     $Param = new SmartParam;
     $Param->param();

     $info_query = $DB->sql_query("SELECT * FROM " . $db_prefix . "info WHERE id='1'");
     $info_row   = $DB->sql_fetch_array($info_query);
	$date              = date('j/n/Y');

 
            
            

    echo "<?xml version=\"1.0\" encoding=\"Windows-1256\" ?>
           <rss version=\"2.0\" xmlns:atom=\"http://www.w3.org/2005/Atom\">
           <channel>
           <title>".$info_row['title']."</title>
	   <atom:link href=\"http://".$info_row['contactus_link']."/rss.php\" rel=\"self\" type=\"application/rss+xml\" />
           <link>http://".$info_row['contactus_link']."/</link>
           <description>http://".$info_row['contactus_link']."/</description>
    ";

 $ttr = $_GET['id']; 
if (empty($ttr))
         {
           $subject_qry = $DB->sql_query("SELECT * FROM " . $db_prefix . "subject WHERE write_date = '$date' AND delete_topic != '1' AND sec_subject != '1' ORDER BY write_time DESC"); 
         

    if($DB->sql_num_rows($subject_qry) <= 0)
    {
          echo "<item>
<title>لا توجد مواضيع جديدة لهذا اليوم ب : ".$info_row['title']."</title>

          </item>
	";
     }
	 }

else{
    $subject_qry = $DB->sql_query("SELECT * FROM " . $db_prefix . "subject WHERE write_date = '$date' AND delete_topic != '1' AND section = '".$ttr."' AND sec_subject != '1'  ORDER BY write_time DESC");


    if($DB->sql_num_rows($subject_qry) <= 0)
    {
          echo "<item>
<title>لا توجد مواضيع جديدة لهذا اليوم بمنتدى : " . $section_row['title'] . "</title>

          </item>
	";
     }
}

     while($subject = $DB->sql_fetch_array($subject_qry))
            {

     echo "<item>
     <title>".$subject['title']."</title>
     <link>http://".$info_row['contactus_link']."/show.php?main=1&amp;id=".$subject['id']."</link>
    
	 <description>".$subject['subject_describe']."</description>
  </item>
	";

}

 echo "
</channel>
</rss>
";


?>
